package com.atbun.oss.controller;

import com.atbun.commonutils.R;
import com.atbun.oss.service.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Description :
 * @Author : mayp
 * @Date: 2020-05-04 23:46
 */
@RestController
@RequestMapping("/eduoss/fileoss")
public class OssController {
    @Autowired
    private FileService fileService;

    @PostMapping
    public R uploadOssFile(MultipartFile file){
        String uploadUrl = fileService.upload(file);
        return R.ok().data("url",uploadUrl);
    }
}
